package com.zhu.websocketdemo.pojo;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.time.LocalDateTime;

@Data
@NoArgsConstructor
public class ResponseMessage {

    @JsonProperty("fromUser")
    private String fromUser;
    @JsonProperty("content")
    private String content;
    @JsonProperty("type")
    private String type;
    @JsonProperty("toUser")
    private String toUser;

    @JsonProperty("timestamp")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime timestamp; // 时间

    public ResponseMessage(String fromUser, String content, String type , LocalDateTime timestamp) {
        this.fromUser = fromUser;
        this.content = content;
        this.type = type;
        this.timestamp = timestamp;
    }
    public ResponseMessage(String fromUser, String toUser, String content, String type, LocalDateTime timestamp) {
        this.fromUser = fromUser;
        this.toUser = toUser;
        this.content = content;
        this.type = type;
        this.timestamp = timestamp;
    }


    public ResponseMessage(String fromUser, String content, String type) {
        this.fromUser = fromUser;
        this.content = content;
        this.type = type;
    }

    public ResponseMessage(String fromUser, String content, String type, String toUser) {
        this.fromUser = fromUser;
        this.content = content;
        this.type = type;
        this.toUser = toUser;
    }

}
